package day09;

/*
 * Author: JacksonCoder
 * FileName: BigDecimalExample
 * Version: 1.0.0
 * Date: 2025/4/15
 */

import java.math.BigDecimal;

public class BigDecimalExample {
    public static void main(String[] args) {
        BigDecimal a = new BigDecimal("0.1");
        BigDecimal b = new BigDecimal("0.2");

        BigDecimal sum = a.add(b);
        System.out.println("相加结果：" + sum);  // 输出：0.3

        BigDecimal div = a.divide(new BigDecimal("3"), 2, BigDecimal.ROUND_HALF_UP);
        System.out.println("除法结果：" + div);  // 输出：0.03
    }
}
